package com.openbravo.beans;

import java.awt.ComponentOrientation;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Enumeration;
import java.util.Vector;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

public class JNumberKeys extends JPanel
{
  private Vector m_Listeners = new Vector();
  private boolean minusenabled = true;
  private boolean equalsenabled = true;
  private JButton m_jCE;
  private JButton m_jEquals;
  private JButton m_jKey0;
  private JButton m_jKey1;
  private JButton m_jKey2;
  private JButton m_jKey3;
  private JButton m_jKey4;
  private JButton m_jKey5;
  private JButton m_jKey6;
  private JButton m_jKey7;
  private JButton m_jKey8;
  private JButton m_jKey9;
  private JButton m_jKeyDot;
  private JButton m_jMinus;
  private JButton m_jMultiply;
  private JButton m_jPlus;

  public JNumberKeys()
  {
    initComponents();
    this.m_jKey0.addActionListener(new MyKeyNumberListener('0'));
    this.m_jKey1.addActionListener(new MyKeyNumberListener('1'));
    this.m_jKey2.addActionListener(new MyKeyNumberListener('2'));
    this.m_jKey3.addActionListener(new MyKeyNumberListener('3'));
    this.m_jKey4.addActionListener(new MyKeyNumberListener('4'));
    this.m_jKey5.addActionListener(new MyKeyNumberListener('5'));
    this.m_jKey6.addActionListener(new MyKeyNumberListener('6'));
    this.m_jKey7.addActionListener(new MyKeyNumberListener('7'));
    this.m_jKey8.addActionListener(new MyKeyNumberListener('8'));
    this.m_jKey9.addActionListener(new MyKeyNumberListener('9'));
    this.m_jKeyDot.addActionListener(new MyKeyNumberListener('.'));
    this.m_jMultiply.addActionListener(new MyKeyNumberListener('*'));
    this.m_jCE.addActionListener(new MyKeyNumberListener(''));
    this.m_jPlus.addActionListener(new MyKeyNumberListener('+'));
    this.m_jMinus.addActionListener(new MyKeyNumberListener('-'));
    this.m_jEquals.addActionListener(new MyKeyNumberListener('='));
  }

  public void setNumbersOnly(boolean paramBoolean)
  {
    this.m_jEquals.setVisible(paramBoolean);
    this.m_jMinus.setVisible(paramBoolean);
    this.m_jPlus.setVisible(paramBoolean);
    this.m_jMultiply.setVisible(paramBoolean);
  }

  public void setEnabled(boolean paramBoolean)
  {
    super.setEnabled(paramBoolean);
    this.m_jKey0.setEnabled(paramBoolean);
    this.m_jKey1.setEnabled(paramBoolean);
    this.m_jKey2.setEnabled(paramBoolean);
    this.m_jKey3.setEnabled(paramBoolean);
    this.m_jKey4.setEnabled(paramBoolean);
    this.m_jKey5.setEnabled(paramBoolean);
    this.m_jKey6.setEnabled(paramBoolean);
    this.m_jKey7.setEnabled(paramBoolean);
    this.m_jKey8.setEnabled(paramBoolean);
    this.m_jKey9.setEnabled(paramBoolean);
    this.m_jKeyDot.setEnabled(paramBoolean);
    this.m_jMultiply.setEnabled(paramBoolean);
    this.m_jCE.setEnabled(paramBoolean);
    this.m_jPlus.setEnabled(paramBoolean);
    this.m_jMinus.setEnabled((this.minusenabled) && (paramBoolean));
    this.m_jEquals.setEnabled((this.equalsenabled) && (paramBoolean));
  }

  public void setComponentOrientation(ComponentOrientation paramComponentOrientation)
  {
  }

  public void setMinusEnabled(boolean paramBoolean)
  {
    this.minusenabled = paramBoolean;
    this.m_jMinus.setEnabled((this.minusenabled) && (isEnabled()));
  }

  public boolean isMinusEnabled()
  {
    return this.minusenabled;
  }

  public void setEqualsEnabled(boolean paramBoolean)
  {
    this.equalsenabled = paramBoolean;
    this.m_jEquals.setEnabled((this.equalsenabled) && (isEnabled()));
  }

  public boolean isEqualsEnabled()
  {
    return this.equalsenabled;
  }

  public boolean isNumbersOnly()
  {
    return this.m_jEquals.isVisible();
  }

  public void addJNumberEventListener(JNumberEventListener paramJNumberEventListener)
  {
    this.m_Listeners.add(paramJNumberEventListener);
  }

  public void removeJNumberEventListener(JNumberEventListener paramJNumberEventListener)
  {
    this.m_Listeners.remove(paramJNumberEventListener);
  }

  private void initComponents()
  {
    this.m_jCE = new JButton();
    this.m_jMultiply = new JButton();
    this.m_jMinus = new JButton();
    this.m_jPlus = new JButton();
    this.m_jKey9 = new JButton();
    this.m_jKey8 = new JButton();
    this.m_jKey7 = new JButton();
    this.m_jKey4 = new JButton();
    this.m_jKey5 = new JButton();
    this.m_jKey6 = new JButton();
    this.m_jKey3 = new JButton();
    this.m_jKey2 = new JButton();
    this.m_jKey1 = new JButton();
    this.m_jKey0 = new JButton();
    this.m_jKeyDot = new JButton();
    this.m_jEquals = new JButton();
    setLayout(new GridBagLayout());
    setBorder(new EmptyBorder(new Insets(5, 5, 5, 5)));
    this.m_jCE.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/btnce.png")));
    this.m_jCE.setFocusPainted(false);
    this.m_jCE.setFocusable(false);
    this.m_jCE.setMargin(new Insets(8, 16, 8, 16));
    this.m_jCE.setRequestFocusEnabled(false);
    GridBagConstraints localGridBagConstraints = new GridBagConstraints();
    localGridBagConstraints.gridx = 0;
    localGridBagConstraints.gridy = 0;
    localGridBagConstraints.gridwidth = 2;
    localGridBagConstraints.fill = 1;
    localGridBagConstraints.weightx = 1.0D;
    localGridBagConstraints.weighty = 1.0D;
    add(this.m_jCE, localGridBagConstraints);
    this.m_jMultiply.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/btnmult.png")));
    this.m_jMultiply.setFocusPainted(false);
    this.m_jMultiply.setFocusable(false);
    this.m_jMultiply.setMargin(new Insets(8, 16, 8, 16));
    this.m_jMultiply.setRequestFocusEnabled(false);
    localGridBagConstraints = new GridBagConstraints();
    localGridBagConstraints.gridx = 2;
    localGridBagConstraints.gridy = 0;
    localGridBagConstraints.fill = 1;
    localGridBagConstraints.weightx = 1.0D;
    localGridBagConstraints.weighty = 1.0D;
    localGridBagConstraints.insets = new Insets(0, 5, 0, 0);
    add(this.m_jMultiply, localGridBagConstraints);
    this.m_jMinus.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/btnminus.png")));
    this.m_jMinus.setFocusPainted(false);
    this.m_jMinus.setFocusable(false);
    this.m_jMinus.setMargin(new Insets(8, 16, 8, 16));
    this.m_jMinus.setRequestFocusEnabled(false);
    localGridBagConstraints = new GridBagConstraints();
    localGridBagConstraints.gridx = 3;
    localGridBagConstraints.gridy = 0;
    localGridBagConstraints.fill = 1;
    localGridBagConstraints.weightx = 1.0D;
    localGridBagConstraints.weighty = 1.0D;
    localGridBagConstraints.insets = new Insets(0, 5, 0, 0);
    add(this.m_jMinus, localGridBagConstraints);
    this.m_jPlus.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/btnplus.png")));
    this.m_jPlus.setFocusPainted(false);
    this.m_jPlus.setFocusable(false);
    this.m_jPlus.setMargin(new Insets(8, 16, 8, 16));
    this.m_jPlus.setRequestFocusEnabled(false);
    localGridBagConstraints = new GridBagConstraints();
    localGridBagConstraints.gridx = 3;
    localGridBagConstraints.gridy = 1;
    localGridBagConstraints.gridheight = 2;
    localGridBagConstraints.fill = 1;
    localGridBagConstraints.weightx = 1.0D;
    localGridBagConstraints.weighty = 1.0D;
    localGridBagConstraints.insets = new Insets(5, 5, 0, 0);
    add(this.m_jPlus, localGridBagConstraints);
    this.m_jKey9.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/btn9.png")));
    this.m_jKey9.setFocusPainted(false);
    this.m_jKey9.setFocusable(false);
    this.m_jKey9.setMargin(new Insets(8, 16, 8, 16));
    this.m_jKey9.setRequestFocusEnabled(false);
    localGridBagConstraints = new GridBagConstraints();
    localGridBagConstraints.gridx = 2;
    localGridBagConstraints.gridy = 1;
    localGridBagConstraints.fill = 1;
    localGridBagConstraints.weightx = 1.0D;
    localGridBagConstraints.weighty = 1.0D;
    localGridBagConstraints.insets = new Insets(5, 5, 0, 0);
    add(this.m_jKey9, localGridBagConstraints);
    this.m_jKey8.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/btn8.png")));
    this.m_jKey8.setFocusPainted(false);
    this.m_jKey8.setFocusable(false);
    this.m_jKey8.setMargin(new Insets(8, 16, 8, 16));
    this.m_jKey8.setRequestFocusEnabled(false);
    localGridBagConstraints = new GridBagConstraints();
    localGridBagConstraints.gridx = 1;
    localGridBagConstraints.gridy = 1;
    localGridBagConstraints.fill = 1;
    localGridBagConstraints.weightx = 1.0D;
    localGridBagConstraints.weighty = 1.0D;
    localGridBagConstraints.insets = new Insets(5, 5, 0, 0);
    add(this.m_jKey8, localGridBagConstraints);
    this.m_jKey7.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/btn7.png")));
    this.m_jKey7.setFocusPainted(false);
    this.m_jKey7.setFocusable(false);
    this.m_jKey7.setMargin(new Insets(8, 16, 8, 16));
    this.m_jKey7.setRequestFocusEnabled(false);
    localGridBagConstraints = new GridBagConstraints();
    localGridBagConstraints.gridx = 0;
    localGridBagConstraints.gridy = 1;
    localGridBagConstraints.fill = 1;
    localGridBagConstraints.weightx = 1.0D;
    localGridBagConstraints.weighty = 1.0D;
    localGridBagConstraints.insets = new Insets(5, 0, 0, 0);
    add(this.m_jKey7, localGridBagConstraints);
    this.m_jKey4.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/btn4.png")));
    this.m_jKey4.setFocusPainted(false);
    this.m_jKey4.setFocusable(false);
    this.m_jKey4.setMargin(new Insets(8, 16, 8, 16));
    this.m_jKey4.setRequestFocusEnabled(false);
    localGridBagConstraints = new GridBagConstraints();
    localGridBagConstraints.gridx = 0;
    localGridBagConstraints.gridy = 2;
    localGridBagConstraints.fill = 1;
    localGridBagConstraints.weightx = 1.0D;
    localGridBagConstraints.weighty = 1.0D;
    localGridBagConstraints.insets = new Insets(5, 0, 0, 0);
    add(this.m_jKey4, localGridBagConstraints);
    this.m_jKey5.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/btn5.png")));
    this.m_jKey5.setFocusPainted(false);
    this.m_jKey5.setFocusable(false);
    this.m_jKey5.setMargin(new Insets(8, 16, 8, 16));
    this.m_jKey5.setRequestFocusEnabled(false);
    localGridBagConstraints = new GridBagConstraints();
    localGridBagConstraints.gridx = 1;
    localGridBagConstraints.gridy = 2;
    localGridBagConstraints.fill = 1;
    localGridBagConstraints.weightx = 1.0D;
    localGridBagConstraints.weighty = 1.0D;
    localGridBagConstraints.insets = new Insets(5, 5, 0, 0);
    add(this.m_jKey5, localGridBagConstraints);
    this.m_jKey6.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/btn6.png")));
    this.m_jKey6.setFocusPainted(false);
    this.m_jKey6.setFocusable(false);
    this.m_jKey6.setMargin(new Insets(8, 16, 8, 16));
    this.m_jKey6.setRequestFocusEnabled(false);
    localGridBagConstraints = new GridBagConstraints();
    localGridBagConstraints.gridx = 2;
    localGridBagConstraints.gridy = 2;
    localGridBagConstraints.fill = 1;
    localGridBagConstraints.weightx = 1.0D;
    localGridBagConstraints.weighty = 1.0D;
    localGridBagConstraints.insets = new Insets(5, 5, 0, 0);
    add(this.m_jKey6, localGridBagConstraints);
    this.m_jKey3.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/btn3.png")));
    this.m_jKey3.setFocusPainted(false);
    this.m_jKey3.setFocusable(false);
    this.m_jKey3.setMargin(new Insets(8, 16, 8, 16));
    this.m_jKey3.setRequestFocusEnabled(false);
    localGridBagConstraints = new GridBagConstraints();
    localGridBagConstraints.gridx = 2;
    localGridBagConstraints.gridy = 3;
    localGridBagConstraints.fill = 1;
    localGridBagConstraints.weightx = 1.0D;
    localGridBagConstraints.weighty = 1.0D;
    localGridBagConstraints.insets = new Insets(5, 5, 0, 0);
    add(this.m_jKey3, localGridBagConstraints);
    this.m_jKey2.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/btn2.png")));
    this.m_jKey2.setFocusPainted(false);
    this.m_jKey2.setFocusable(false);
    this.m_jKey2.setMargin(new Insets(8, 16, 8, 16));
    this.m_jKey2.setRequestFocusEnabled(false);
    localGridBagConstraints = new GridBagConstraints();
    localGridBagConstraints.gridx = 1;
    localGridBagConstraints.gridy = 3;
    localGridBagConstraints.fill = 1;
    localGridBagConstraints.weightx = 1.0D;
    localGridBagConstraints.weighty = 1.0D;
    localGridBagConstraints.insets = new Insets(5, 5, 0, 0);
    add(this.m_jKey2, localGridBagConstraints);
    this.m_jKey1.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/btn1.png")));
    this.m_jKey1.setFocusPainted(false);
    this.m_jKey1.setFocusable(false);
    this.m_jKey1.setMargin(new Insets(8, 16, 8, 16));
    this.m_jKey1.setRequestFocusEnabled(false);
    localGridBagConstraints = new GridBagConstraints();
    localGridBagConstraints.gridx = 0;
    localGridBagConstraints.gridy = 3;
    localGridBagConstraints.fill = 1;
    localGridBagConstraints.weightx = 1.0D;
    localGridBagConstraints.weighty = 1.0D;
    localGridBagConstraints.insets = new Insets(5, 0, 0, 0);
    add(this.m_jKey1, localGridBagConstraints);
    this.m_jKey0.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/btn0.png")));
    this.m_jKey0.setFocusPainted(false);
    this.m_jKey0.setFocusable(false);
    this.m_jKey0.setMargin(new Insets(8, 16, 8, 16));
    this.m_jKey0.setRequestFocusEnabled(false);
    localGridBagConstraints = new GridBagConstraints();
    localGridBagConstraints.gridx = 0;
    localGridBagConstraints.gridy = 4;
    localGridBagConstraints.gridwidth = 2;
    localGridBagConstraints.fill = 1;
    localGridBagConstraints.weightx = 1.0D;
    localGridBagConstraints.weighty = 1.0D;
    localGridBagConstraints.insets = new Insets(5, 0, 0, 0);
    add(this.m_jKey0, localGridBagConstraints);
    this.m_jKeyDot.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/btndot.png")));
    this.m_jKeyDot.setFocusPainted(false);
    this.m_jKeyDot.setFocusable(false);
    this.m_jKeyDot.setMargin(new Insets(8, 16, 8, 16));
    this.m_jKeyDot.setRequestFocusEnabled(false);
    localGridBagConstraints = new GridBagConstraints();
    localGridBagConstraints.gridx = 2;
    localGridBagConstraints.gridy = 4;
    localGridBagConstraints.fill = 1;
    localGridBagConstraints.weightx = 1.0D;
    localGridBagConstraints.weighty = 1.0D;
    localGridBagConstraints.insets = new Insets(5, 5, 0, 0);
    add(this.m_jKeyDot, localGridBagConstraints);
    this.m_jEquals.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/btnequals.png")));
    this.m_jEquals.setFocusPainted(false);
    this.m_jEquals.setFocusable(false);
    this.m_jEquals.setMargin(new Insets(8, 16, 8, 16));
    this.m_jEquals.setRequestFocusEnabled(false);
    localGridBagConstraints = new GridBagConstraints();
    localGridBagConstraints.gridx = 3;
    localGridBagConstraints.gridy = 3;
    localGridBagConstraints.gridheight = 2;
    localGridBagConstraints.fill = 1;
    localGridBagConstraints.weightx = 1.0D;
    localGridBagConstraints.weighty = 1.0D;
    localGridBagConstraints.insets = new Insets(5, 5, 0, 0);
    add(this.m_jEquals, localGridBagConstraints);
  }

  private class MyKeyNumberListener
    implements ActionListener
  {
    private char m_cCad;

    public MyKeyNumberListener(char arg2)
    {
      char c = 0;
      this.m_cCad = c;
    }

    public void actionPerformed(ActionEvent paramActionEvent)
    {
      JNumberEvent localJNumberEvent = new JNumberEvent(JNumberKeys.this, this.m_cCad);
      Enumeration localEnumeration = JNumberKeys.this.m_Listeners.elements();
      while (localEnumeration.hasMoreElements())
      {
        JNumberEventListener localJNumberEventListener = (JNumberEventListener)localEnumeration.nextElement();
        localJNumberEventListener.keyPerformed(localJNumberEvent);
      }
    }
  }
}

/* Location:           D:\PowerFulPOS-2.30.2\openbravopos.jar
 * Qualified Name:     com.openbravo.beans.JNumberKeys
 * JD-Core Version:    0.6.0
 */